import request from '@/utils/request'

const api_name = '/admin/post/category'

// 根据parentId获取下级节点
export const FindAllCategory = () => {
  return request({
    url: `${api_name}/findAllCategory`,
    method: 'get',
  })
}

// 根据parentId获取下级节点
export const FindCategoryByParentId = parentId => {
  return request({
    url: `${api_name}/findByParentId/${parentId}`,
    method: 'get',
  })
}

// 保存信息
export const SaveCategory = category => {
  return request({
    url: `${api_name}/save`,
    method: 'post',
    data: category,
  })
}

// 修改信息
export const UpdateCategoryById = category => {
  return request({
    url: `${api_name}/updateById`,
    method: 'put',
    data: category,
  })
}

// 根据id删除数据
export const RemoveCategoryById = id => {
  return request({
    url: `${api_name}/removeById/${id}`,
    method: 'delete',
  })
}
